<?php
class template_listing extends theme
{
	protected function head()
	{
	?>
<script type="text/javascript" language="javascript" src="js/jquery.validate.pack.js"></script>

<link type="text/css" rel="stylesheet" href="templates/technic/css/listing.css">
<script type="text/javascript" language="javascript" src="templates/technic/js/listing.js"></script>
	<?php
	}

	protected function center()
	{
		$menu_id = $this->get('menu_id');
		$category_id = $this->get('category_id');
		$technics = $this->get('technics');
		$categories = $this->get('categories');
		?>
<div class="center-title">搜索技术文档</div>
<div class="center-content">
	<div class="search-form">
		<form id="form-search">
		关健字: <input type="text" name="key" id="key" size="40" maxlength="60" /> 
		<select name="category_id" id="category_id">
		<?php 
		echo '<option value="0"> - 所有分类 - </option>';
		foreach($categories as $category)
		{
			echo '<option value="'.$category->id.'"';
			if($category->id == $category_id) echo ' selected';
			echo '>';
			echo '- '.$category->name.' -</option>';
		}
		?>
		</select>
		<input type="submit" id="submit" value="搜索" />
		</form>
	</div>
</div>



<div class="center-title">相关文档列表</div>
<div class="center-content">

<div class="technics" id="technics">
<?php 
if(count($technics))
{
	$i=0;
	foreach($technics as $technic)
	{
		?>
		<div class="technic row-<?php echo $i; ?>">
			<ul>
			<li class="name">
				[<?php echo $categories[$technic->category_id]->name; ?>] 
				<a href="<?php echo url('./?controller=technic&task=detail&technic_id='.$technic->id.'&menu_id='.$menu_id ); ?>" target="_blank">
				<?php echo $technic->title; ?>
				</a>
			</li>
			<li class="create_time"><?php echo date('Y-m-d H:i', $technic->create_time); ?></li>
			</ul><div class="clrl"></div>
		</div>
		<?php
		$i = 1-$i;
	}
}
else
{
	echo '没有记录';
}
?>
</div>

<p id="pagination"><?php $this->pagination(); ?></p>

</div>

		<?php
		
	}	

}
?>